<template>
  <view class="note-item">
    <view class="content">
      <text class="title">{{ title }}</text>
      <text class="summary">{{ summary }}</text>
      <view class="meta">
        <view class="time">
          <uni-icons type="calendar" size="20" color="#666"></uni-icons>
          <text style="font-size: 15px;">{{ lastEditTime }}</text>
        </view>
        <view class="tags" v-if="tags.length > 0">
          <view class="tag" v-for="tag in tags" :key="tag">{{ tag }}</view>
        </view>
        <view class="detail_btn" style="margin-left: auto;" @click="clickEdit">
          <uni-icons type="compose" size="24" color="#64b5f6"></uni-icons>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      required: true
    },
    summary: {
      type: String,
      required: true
    },
    lastEditTime: {
      type: String,
      required: true
    },
    tags: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    clickEdit() {
      this.$emit('edit')
    }
  }
}
</script>

<style scoped lang="scss">
.note-item {
  background-color: #ffffff;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 1px;
  box-shadow: 0 6px 30px rgba(100,181,246,0.1);
  border: 1px solid rgba(100,181,246,0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  &:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(100,181,246,0.2);
    border-color: rgba(100,181,246,0.2);
  }

  .content {
    display: flex;
    flex-direction: column;
  }

  .title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;

    &::before {
      content: '';
      width: 6px;
      height: 6px;
      background: #64b5f6;
      border-radius: 50%;
      flex-shrink: 0;
    }
  }

  .summary {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(100,181,246,0.1);

    .time {
      display: flex;
      align-items: center;
      font-size: 12px;
      color: #999;
      gap: 4px;
    }

    .tags {
      display: flex;
      gap: 4px;
      margin-left: auto;

      .tag {
        padding: 2px 6px;
        background: rgba(100,181,246,0.1);
        border-radius: 4px;
        color: #64b5f6;
        font-size: 11px;
        font-weight: 500;
      }
    }
  }
}
</style>
